package com.atguigu.gulimall.product.WebController;


import com.atguigu.gulimall.product.service.SpuInfoService;
import com.atguigu.gulimall.product.vo.SkuItemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.concurrent.ExecutionException;

@Controller
public class ItemController {

      @Autowired
      SpuInfoService spuInfoService;

    /**
     * 获得商品   spu 详情信息
     * @param skuId
     * @return
     */
    @GetMapping("/{skuId}.html")
      public String skuItem(@PathVariable("skuId") Long skuId, Model model) throws ExecutionException, InterruptedException {

         SkuItemVo result=spuInfoService.getSkuItemDetail(skuId);
           model.addAttribute("item",result);
          return "item";
      }



}
